package com.github.aloxc.plugin;

import javax.swing.*;
import java.awt.*;

public class JscrolJanelTest extends JFrame{

    JScrollPane jscrolJanel;
    JTextArea jTextArea[];
    JTextField jTextField[];
    JPanel jPanel ;
    public JscrolJanelTest(){
        this.setSize(Toolkit.getDefaultToolkit().getScreenSize().width,Toolkit.getDefaultToolkit().getScreenSize().height-60);
        jPanel = new JPanel(new GridLayout(50,1));
        jTextField = new JTextField[50];
        jTextArea = new JTextArea[50];
        for (int i = 0; i < jTextArea.length; i++) {
            jTextArea[i] = new JTextArea("师傅师傅说" + i);
            jPanel.add(jTextArea[i]);
        }
        jscrolJanel = new JScrollPane(jPanel,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
//这样设置的水平，垂直都有滚动条
        setContentPane(jscrolJanel);
        setContentPane(jscrolJanel);
    }
    public static void main(String[] args) {
// TODO Auto-generated method stub
        new JscrolJanelTest().setVisible(true);
    }

}
